<?php

/**
 +-----------------------------------------------------
 * PublicModel
 +-----------------------------------------------------
 * @author	liuricheng 
 * @time	2014-03-13
 * @type	[add]
 * 
 */
import("ORG.Util.Function");
import("@.Org.Utils");


class ArticleModel extends Model{

	// 变量
	private  $article		=	"ybr_article";
	private  $goods_article	=	"ybr_goods_article";
	private  $goods			=	"ybr_goods";
	
	// 取得文章关联商品
	public function get_article_goods($article_id){
	    $list = array();
	    $sql  = 'SELECT g.goods_id, g.goods_name' . ' FROM ' . $this->goods_article . ' AS ga' .
	            ' LEFT JOIN ' . $this->goods . ' AS g ON g.goods_id = ga.goods_id'.
	            " WHERE ga.article_id = '$article_id'";
	    return $this->query($sql);   
	}
	
	/**
	 * 根据文章id删除
	 * @param array $ids
	 * 
	 */
	public function delete_article_byids($ids = array()){
		if(empty($ids)){
			return false;
		}
		$idString	=	" (" . implode($ids, ",") . ") ";
		$sql		=	"DELETE from ybr_article WHERE article_id  in " . $idString;
		$this->execute($sql);
		return true;
	}
	

	
		
	
			
}




